<%@page import="com.wodwl.entity.Category"%>
<%@page import="java.util.List"%>
<%@page import="com.wodwl.entity.Blog"%>
<%@page import="com.wodwl.entity.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@include file="../templete/header.jsp" %>
	<script type="text/javascript" src="../../static/ckeditor/ckeditor.js"></script>
</head>
<body >
<%pageContext.setAttribute("linkType","2");%>
<%@include file="../templete/user_info.jsp"  %>
	<%

		Blog blog = (Blog) request.getAttribute("blog");
	%>


		<div class="conR">
			<div class="conR-hd">
				<h3>编辑博客</h3>
			</div>
			<form action="/blog/blog_editor2.do" method="post">
				<input type="hidden" name="username"
					value="<%=user.getUsername()%>"> <input type="hidden"
					name="bid" value="<%=blog.getBid()%>">
				<table>
					<tr>
						<td>标题：</td>
						<td><input type="text" name="title"
							value="<%=blog.getTitle()%>"></td>
					</tr>
					<tr>
						<td>分类：</td>
						<td>
						
						<%
						List<Category> categories=(List<Category>)request.getAttribute("categories");
						if(categories!=null&&categories.size()>0){
						%>
						<select name="cid">
							<%for(int i=0;i<categories.size();i++){
								Category item=categories.get(i);
								if(item.getCid()==blog.getCid()){
							%>
							<option value="<%=item.getCid()%>" selected="selected"><%=item.getCname() %></option>
							<%} else{%>
							<option value="<%=item.getCid()%>"><%=item.getCname() %></option>
							<%}} %>
						</select>
						<%}else{%>
							<a href="/blog/category_list.do">添加分类</a>
						<%} %>
						</td>
					</tr>
					<tr>
						<td colspan="2"><textarea name="content"id="content"><%=blog.getContent()%></textarea></td>
					</tr>
					<tr>
						<td colspan="2"><input type="submit" value="提交"></td>
					</tr>
				</table>

				<script type="text/javascript">
					CKEDITOR.replace("content", {
						skin : "kama",
						width : 800,
						height : 400
					});
				</script>
			</form>
			<br />
			<p class="pager-wrap pageList">
				<span class="pageList-cur">1</span> <a href="#" class="link-lb">2</a>
				<a href="#" class="link-lb">3</a> <a class="link-lb" href="#">下一页</a>
			</p>
		</div>
	</div>
	<jsp:include page="../templete/footer.jsp"></jsp:include>
</body>
</html>